export const showToast = function(params) {
  let duration = params.duration
  let title = params.title
  let icon = params.icon??'none'
  if(!duration) duration = 2000
  wx.showToast({
      title: title,
      icon: icon,
      duration: duration,
  })
}

var isShowLoading = false
export const showLoading = function(title) {
  if(isShowLoading) return
  wx.showLoading({
      title: title?title:'',
      mask:true,
      success:()=>{
          isShowLoading = true
      }
  })
}

export const hideLoading = function() {
  if(!isShowLoading) return
  isShowLoading = false
  wx.hideLoading()
}